package com.corpgovernment.organization.enumm;

import java.util.Arrays;

public enum ValidEnum {

    T("T", "使用中", "1"),

    F("F", "已停用", "0");

    private String code;
    private String desc;
    private String frontCode;

    ValidEnum(String code, String desc, String frontCode) {
        this.code = code;
        this.desc = desc;
        this.frontCode = frontCode;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public String getFrontCode() {
        return frontCode;
    }

    public static ValidEnum getByCode(String code) {
        return Arrays.stream(ValidEnum.values()).filter(e -> code.equals(e.code)).findFirst().orElse(null);
    }
}
